require(["common", "hash_routie", "coAjax", "queryString", "jQuery", "browser", "href", "eventManager", "/js/common/goodsCart.js"], function(jSouper, hash_routie, coAjax, QueryString, $, browser, href, eventManager, goodsCart) {
	//获取指定页的商品
	coAjax.get(appConfig.goods.list, {
		bus_id: appConfig.bus_id,
		num: 18,
		page: 0
	}, function(result) {
		var goods_list = result.result;
		App.set("goods_list", goods_list);
	}, function() {
		console.log(arguments);
	});

	// 加载标签列表
	App.model.toggle('loadingoods');
	coAjax.get(appConfig.bus.tags_detail, {
		bus_id: appConfig.bus_id
	}, function(result) {
		App.set("$Cache.tags_detail", result.result);
		App.model.toggle('loadingoods');
	});

	function _get_cart_success(result) {
		var cart_detail = result.result;
		App.set("user.cart_detail", cart_detail);
		href.jump("/mobile.main.html#default/cart");
	};

	App.set("$Event.goods_list.add_to_cart", function(e, vm) {
		var cart_item = {
			goods_id: vm.get("_id"),
			num: 1
		};
		goodsCart.add_to_cart(vm.get("_id"), 1, _get_cart_success)
	});
})